import { createApp} from 'vue'
import App from './App.vue'
import './index.css'

import axios from "axios";
import VueAxios from "vue-axios";
import {createRouter,createWebHistory} from 'vue-router'
const app = createApp(App)
//----------------
import Homepage from "./components/Homepage.vue";
import Listname from "./components/Listname.vue";
const routers= [
    {path:'/',component:Homepage,
    children:[
        {path:'/:listname',component:Listname}
    ]},

]
const router = createRouter({
    history:createWebHistory(),
    routes:routers
})

//-----------------
app.config.globalProperties.$axios = axios
axios.defaults.baseURL = "https://mediachain.info/api"
axios.defaults.timeout = 5000
axios.interceptors.request.use(
    config => {
        console.log("config:", config);
        return config
    }, error => {
        console.log(error)
    }
)
//-----------------
// const router = useRoute({
//
// })
app
    .use(router)
    .use(VueAxios, axios)
    .mount('#app')
